package com.unicom.aop.annotation;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.framework.AopContext;


/**
 * @author liry
 * @version 1.0
 * @date Created on 2021/12/14 15:30
 * Description:
 */
public class TestBean {
	public static final Logger log = LoggerFactory.getLogger(TestBean.class);

	private String testStr = "testStr";

	public String getTestStr() {
		return testStr;
	}

	public void setTestStr(String testStr) {
		this.testStr = testStr;
	}

	public void test(String str){
		log.info("------执行目标方法 test {} ------", str);
		// 调用this.show并没有对该方法进行增强
//		this.show();
		// 需要在aspectJAutoProxy中设置exposeProxy = true参数
		((TestBean)AopContext.currentProxy()).show();
	}

	public void show(){
		log.info("------执行目标方法 show ------");
	}


}
